(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(blink-cursor-mode nil)
 '(column-number-mode t)
 '(custom-safe-themes (quote ("2b5aa66b7d5be41b18cc67f3286ae664134b95ccc4a86c9339c886dfd736132d" "e292ec749f785d348969926448e25790356a7ce1a8fda6e695f5e8b70bed786b" "59fecff62e1539cafd2d88dcb08d1775ac83b8b5da8b503ef250552cfb71824f" "d8a4e35ee1b219ccb8a8c15cdfed687fcc9d467c9c8b9b93bd25229b026e4703" default)))
 '(delete-selection-mode t)
 '(flx-ido-mode t)
 '(ido-auto-merge-work-directories-length -1)
 '(ido-create-new-buffer (quote always))
 '(ido-default-file-method (quote selected-window))
 '(ido-enable-flex-matching t)
 '(ido-max-prospects 10)
 '(ido-mode (quote both) nil (ido))
 '(ido-ubiquitous-mode t)
 '(ido-use-faces nil)
 '(ido-use-filename-at-point (quote guess))
 '(scroll-bar-mode nil)
 '(selection-coding-system (quote utf-16le-dos))
 '(show-paren-mode t)
 '(size-indication-mode t)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(helm-selection ((t (:background "black" :underline nil))))
 '(ido-first-match ((t (:foreground "black" :weight bold))))
 '(show-paren-match ((t (:background "slate gray" :foreground "midnight blue")))))


(eval-after-load "indent-guide-mode"
  '(setq-default indent-guide-mode t)
  ;;  (set-face-background 'indent-guide-face "dimgray")
  )

(defun qiang-font-existsp (font)
  (if (null (x-list-fonts font))
      nil
    t))

(defvar font-list '("Microsoft Yahei" "文泉驿等宽微米黑" "黑体" "新宋体" "宋体"))

(require 'cl) ;; find-if is in common list package
(find-if #'qiang-font-existsp font-list)
(defun qiang-make-font-string (font-name font-size)
  (if (and (stringp font-size)
           (equal ":" (string (elt font-size 0))))
      (format "%s%s" font-name font-size)
    (format "%s %s" font-name font-size)))

(defun qiang-set-font (english-fonts
                       english-font-size
                       chinese-fonts
                       &optional chinese-font-size)

  "english-font-size could be set to \":pixelsize=18\" or a integer.
If set/leave chinese-font-size to nil, it will follow english-font-size"
  (require 'cl) ; for find if
  (let ((en-font (qiang-make-font-string
                  (find-if #'qiang-font-existsp english-fonts)
                  english-font-size))
        (zh-font (font-spec :family (find-if #'qiang-font-existsp chinese-fonts)
                            :size chinese-font-size)))

    ;; Set the default English font
    ;;
    ;; The following 2 method cannot make the font settig work in new frames.
    ;; (set-default-font "Consolas:pixelsize=18")
    ;; (add-to-list 'default-frame-alist '(font . "Consolas:pixelsize=18"))
    ;; We have to use set-face-attribute
    (message "Set English Font to %s" en-font)
    (set-face-attribute 'default nil :font en-font)
    ;; Set Chinese font
    ;; Do not use 'unicode charset, it will cause the English font setting invalid
    (message "Set Chinese Font to %s" zh-font)
    (dolist (charset '(kana han symbol cjk-misc bopomofo))
      (set-fontset-font (frame-parameter nil 'font)
                        charset zh-font))))


(qiang-set-font
 '("Consolas" "Monaco" "DejaVu Sans Mono" "Monospace" "Courier New") ":pixelsize=11"
 '("Microsoft Yahei" "YaHei Consolas Hybrid" "文泉驿等宽微米黑"  "文泉驿等宽微米黑" "黑体" "新宋体" "宋体" "Hiragino Sans GB" )  )



(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font (frame-parameter nil 'font)
                    charset
                    (font-spec :family "YaHei Consolas Hybrid" :size 16)))

;;(set-face-attribute
;; 'default nil :font "Consolas 11")

;; (set-face-attribute
;; 'default nil :font "微软雅黑 12")

(require 'auto-complete-config)
(ac-config-default)

(require 'switch-window)

(global-set-key (kbd "RET") 'newline-and-indent)

(setq-default indent-guide-mode t)

(set-frame-parameter nil 'alpha 92)

(setq calendar-latitude +35.24)
(setq calendar-longitude +115.43)
(setq calendar-location-name "heze")


(setq visible-bell nil)
(setq ring-bell-function 'ignore)

;(global-set-key (kbd "C-x C-r") 'recentf-open-files)
(global-set-key (kbd "C-x C-r") 'helm-recentf)


(require 'yasnippet)
(require 'dropdown-list)
(setq yas-prompt-functions '(yas-dropdown-prompt
                             yas-ido-prompt
                             yas-completing-prompt))
(add-to-list 'yas-snippet-dirs prelude-snippets-dir)
;(add-to-list 'yas-snippet-dirs prelude-personal-snippets-dir)
(yas-global-mode 1)
(powerline-default-theme)


(setq web-mode-enable-css-colorization t)


;; (set-face-attribute 'mode-line nil :box nil)
;; (set-face-attribute 'mode-line-inactive nil :box nil)

;(set-face-attribute 'vertical-border nil :foreground "#484a4e")
(set-face-background 'fringe "#272738")

(require 'unicad)
(unicad-enable)
(electric-pair-mode 1)
;; (setq default-frame-alist
;;       '((height . 35) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0)))


;;cua set
(setq cua-enable-cua-keys nil)
(cua-mode 1)
(iswitchb-mode 1)

;; Alt+y is not cua-repeat-replace-region
(define-key cua--cua-keys-keymap [(meta v)] 'nil)




(prefer-coding-system 'chinese-gbk)
(prefer-coding-system 'utf-8)

(prefer-coding-system 'euc-cn)
(setq locale-coding-system 'euc-cn)
(set-coding-system-priority 'gbk)

;;(require-laravel)
;;(add-hook 'projectile-mode-hook 'laravel-on)
